home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkMeter.h.z / VkMeter.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  3.3 KB  |  97 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #ifndef VKMETER_H
  18. #define VKMETER_H
  19.  
  20. #include <Vk/VkDoubleBuffer.h>
  21.  
  22. #define DONT_EDGE_START        (1 << 0)
  23. #define DONT_EDGE_FINISH    (1 << 1)
  24. #define DONT_EDGE_TOP        (1 << 2)
  25. #define DONT_EDGE_BOTTOM    (1 << 3)
  26. #define DONT_EDGE_SIDE        (1 << 4)
  27.  
  28.  
  29. struct MeterInfo {
  30.     int start;
  31.     int end;
  32.     int top, bottom;
  33.     char *label;
  34.     Pixel color;
  35.     int flags;            /* DONT_EDGE_START, DONT_EDGE_FINISH,
  36.                    DONT_EDGE_TOP, DONT_EDGE_BOTTOM,
  37.                    DONT_EDGE_SIDE */
  38. };
  39.  
  40.  
  41. class VkMeter : public VkDoubleBuffer {
  42.  
  43.  
  44.   public:
  45.  
  46.     VkMeter(const char *name, Widget parent);
  47.     ~VkMeter();
  48.  
  49.     void reset(int range = -1, int units = -1);
  50.     void update();
  51.  
  52.     void add(int value, char *color, char *label = NULL);
  53.     void add(int value, Pixel pixel, char *label = NULL);
  54.     void add(int value, int thickness, char *color, char *label = NULL);
  55.     void add(int value, int thickness, Pixel pixel, char *label = NULL);
  56.  
  57.     void add(int start, int size, int sideValue, int thickness, char *color, char *label = NULL);
  58.     void add(int start, int size, int sideValue, int thickness, Pixel color, char *label = NULL);
  59.  
  60.     void setResizePolicy( unsigned char policy ) { _resizePolicy = policy; }
  61.     void setOrientation (unsigned char value) { _orientation = value;}
  62.     
  63.     void setTitle(const char *);  // Not implemented yet
  64.     virtual const char* className();
  65.  
  66.   protected:
  67.  
  68.     virtual void afterRealizeHook();
  69.     unsigned char _resizePolicy;
  70.  
  71.     MeterInfo *_info;
  72.     char      *_title;
  73.     int        _peak;
  74.     int        _unitHeight;
  75.     GC         _gc;
  76.     GC         _borderGC;
  77.     XmFontList _fontList;
  78.     int        _numItems;
  79.     Boolean    _drawBorder;
  80.     Pixel      _borderColor;
  81.     int        _factor;
  82.     int        _lastValue;
  83.     unsigned char _orientation;
  84.  
  85.     virtual void resize();
  86.     void draw();
  87.     virtual Dimension neededWidth() { return (_width); }    
  88.     virtual Dimension neededHeight(){ return (_height); }    
  89.  
  90.   private:
  91.  
  92.     static String     _resources[];
  93.     static XtResource _resSpec [];
  94. }; 
  95.  
  96. #endif
  97.